<template>
  <div class="layout-panel">
    <div class="layout-panel-head" v-if="title !== null">
      <div class="layout-panel-title">
        <slot name="title">{{ title }}</slot>
        <span>{{ tip }}</span>
      </div>
    </div>
    <div class="layout-panel-body"><slot></slot></div>
  </div>
</template>
<script>
export default {
  name: 'layoutPanel',
  props: {
    title: {
      type: String,
      default: '',
    },
    tip: {
      type: String,
      default: '',
    },
  },
};
</script>
<style lang="less" scoped>
.layout-panel {
  margin-bottom: 12px;
  .layout-panel-head {
    display: flex;
    align-items: center;
    height: 32px;
    margin-bottom: 12px;
    .title {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    &::before {
      content: '';
      width: 4px;
      height: 14px;
      background-color: @theme-color;
      margin-right: 8px;
    }
    .layout-panel-title {
      color: @text-primary;
      font-weight: 600;
      width: 100%;
      text-align: left;
    }
  }
  + .layout-panel {
    margin-top: 16px;
  }
}
</style>
